package android.com.app;

import android.content.Context;
import android.content.Intent;
import android.media.MediaScannerConnection;
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
import android.net.Uri;
import android.util.Log;
/*
 * MediaScanner is used to detect any additions to the content provider. We use to exclusively call it for thumbnails we add
 */
public class MediaScannerNotifier implements MediaScannerConnectionClient {
     private Context mContext;
     private MediaScannerConnection mConnection;
     private String mPath;
     private String mMimeType;
     //constructor
     public MediaScannerNotifier(Context context, String path, String mimeType) {
    	// Log.i("MediaScannerNotifier.Const()","started"+path);
    	 mContext = context;
         mPath = path;
         mMimeType = mimeType;
         mConnection = new MediaScannerConnection(context, this);
         mConnection.connect();
        // Log.i("MediaScannerNotifier.Const()","ended");
     }
     
     public void onMediaScannerConnected() {
    	 //.i("MediaScannerNotifier.onMediaScannerConnected()","started"+mPath);
         mConnection.scanFile(mPath, mMimeType);
         //Log.i("MediaScannerNotifier.onMediaScannerConnected()","ended");
     }
     //	will be called once the scanning is complete
     public void onScanCompleted(String path, Uri uri) {
         // OPTIONAL: scan is complete, this will cause the viewer to render it
         try {
             if (uri != null) {
            	 
             }
         } finally {
             mConnection.disconnect();
             mContext = null;
         }
    }
     
}